/*
 * Fraction_F.h
 *
 *  Created on: Nov 21, 2012
 *      Author: lucid
 */

#ifndef FRACTION_F_H_
#define FRACTION_F_H_


class fractionf_t
{
protected:
	int m_iInteger;
	int m_iNumerator;
	int m_iDenominator;

public:
	fractionf_t();
	fractionf_t(int iInteger,int iNumerator,int iDenominator);
	~fractionf_t();

	operator double();
	fractionf_t operator +(fractionf_t rhs);
	fractionf_t& operator +=(fractionf_t rhs);

	fractionf_t operator -(const fractionf_t& rhs);
	fractionf_t& operator -=(const fractionf_t& rhs);

	fractionf_t operator *(const fractionf_t& rhs);
	fractionf_t& operator *=(const fractionf_t& rhs);

	fractionf_t operator /(const fractionf_t& rhs);
	fractionf_t& operator /=(const fractionf_t& rhs);

protected:
	BOOL _fitsign();
	BOOL reduction();
	BOOL ImporperToPorper();
	BOOL PorperToImporper();
	//Find the lowest common multiple
	static int FindLCM(int iVal1,int iVal2);
	//Find the greatest common divisor
	static int FindGCD(int iVal1,int iVal2);
};


#endif /* FRACTION_F_H_ */
